package com.sgy.handwrite_mvc.mvcframework.pojo;

import lombok.Data;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

@Data
public class Handler {

    private Object controller;

    private Method method;

    private Pattern pattern;

    /**
     * 参数顺序，方便进行参数绑定
     * key是参数名，value表示第几个参数
     */
    private Map<String, Integer> paramIndexMapping;

    public Handler(Object controller, Method method, Pattern pattern) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
        this.paramIndexMapping = new HashMap<>();
    }
}
